package com.glsc.ngateway.common.base.converter.oaflow;

import cn.hutool.json.JSONUtil;
import com.alibaba.excel.util.CollectionUtils;
import com.glsc.ngateway.common.api.common.dto.AppendIdDto;
import com.glsc.ngateway.common.api.oaflow.dto.VITSystemOAFlowResourceDto;
import com.glsc.ngateway.common.base.domain.oracle.ecology.VITSystemOAFlowResource;
import org.apache.logging.log4j.util.Strings;

import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

public class VITSystemOAFlowResourceConverter {
    public static VITSystemOAFlowResourceDto do2Dto(VITSystemOAFlowResource domain) {
        if (Objects.isNull(domain)) {
            return null;
        }
        return VITSystemOAFlowResourceDto.builder()
                .workflowName(domain.getWorkflowName())
                .requestName(domain.getRequestName())
                .requestId(domain.getRequestId())
                .userName(domain.getUserName())
                .systemClassNo(domain.getSystemClassNo())
                .applyDate(domain.getApplyDate())
                .changeLevel(domain.getChangeLevel())
                .build();
    }

    public static List<VITSystemOAFlowResourceDto> do2Dto(List<VITSystemOAFlowResource> domainList) {
        return CollectionUtils.isEmpty(domainList) ? java.util.Collections.emptyList() : domainList.stream().map(VITSystemOAFlowResourceConverter::do2Dto).collect(Collectors.toList());
    }

    public static VITSystemOAFlowResource dto2Do(VITSystemOAFlowResourceDto dto) {
        if (Objects.isNull(dto)) {
            return null;
        }
        return VITSystemOAFlowResource.builder()
                .workflowName(dto.getWorkflowName())
                .requestName(dto.getRequestName())
                .requestId(dto.getRequestId())
                .userName(dto.getUserName())
                .systemClassNo(dto.getSystemClassNo())
                .applyDate(dto.getApplyDate())
                .changeLevel(dto.getChangeLevel())
                .build();
    }
    public static List<VITSystemOAFlowResource> dto2Do(List<VITSystemOAFlowResourceDto> domainList) {
        return CollectionUtils.isEmpty(domainList) ? java.util.Collections.emptyList() : domainList.stream().map(VITSystemOAFlowResourceConverter::dto2Do).collect(Collectors.toList());
    }
}
